<?php
$model_article_category = new Model_ArticleCat_ArticleCat();
$model_article = new Model_Article_Article();
$data = $this->data;
$itemCat = $this->itemCat;
$alias = $this->alias;
?>
<script type="text/javascript">
$(document).ready(function(){
	var inc=10;
	$(window).scroll(function() {
	    if ($('body').height()-190 <= ($(window).height() + $(window).scrollTop())) {
	    	inc=inc+10;
	        var dataString = inc;
	        $.ajax({
	            type: "POST",
	            url: "<?php echo $this->baseUrl();?>/default/articlecat/list/",
	            data: {'limit': dataString,'alias':'<?php echo $alias; ?>'},
	            success: function(data) {
	                $('#news_items').html(data);
	            }
	        });
	    }
	});
});
</script>
<div class="main product_page">
<div class="container">
<?php 
	if($alias != 'tin-tuc' && $alias != 'tu-van') 
	{
		?> 
		<div class="news">
		<div class="topnews">
		<h3><?php echo $itemCat['name'];?></h3>
		</div>
		<ul id="news_items">
		<?php
		foreach($data as $item)
		{
			?>
			<li>
			<h4><a
				href="<?php echo $this->baseUrl().$model_article->getLinkById($item['id']);?>"><?php echo $item['name'];?></a></h4>
			<img
				src="<?php echo $this->baseUrl()?>/public/images/articles/<?php echo $item['image'];?>"
				alt="" />
			<p><?php echo $item['description'];?></p>
			</li>
		
			<?php
		}
		?>
		</ul>
		</div>
<?php 
	}
	else
	{
		$id_tuvan = $model_article_category->getItemAlias('tu-van');
		$data_tuvan = array();
		if($id_tuvan!='')
			$data_tuvan = $model_article->getItemsByCate($id_tuvan['id']);
?>
	<div class="news" id="<?php echo $alias?>">
		<div class="topnews">
		<h3><?php echo $itemCat['name'];?></h3>
		</div>
		<ul id="news_items">
		<?php
		foreach($data as $item)
		{
			?>
			<li>
			<h4><a
				href="<?php echo $this->baseUrl().$model_article->getLinkById($item['id']);?>"><?php echo $item['name'];?></a></h4>
			<img
				src="<?php echo $this->baseUrl()?>/public/images/articles/<?php echo $item['image'];?>"
				alt="" />
			<p><?php echo $item['description'];?></p>
			</li>
		
			<?php
		}
		?>
		</ul>
	</div>
	<div class="news" id="tu-van">
		<div class="topnews">
		<h3>Tư vấn</h3>
		</div>
		<ul id="news_items">
		<?php
		foreach($data_tuvan as $item)
		{
			?>
			<li>
			<h4><a
				href="<?php echo $this->baseUrl().$model_article->getLinkById($item['id']);?>"><?php echo $item['name'];?></a></h4>
			<img
				src="<?php echo $this->baseUrl()?>/public/images/articles/<?php echo $item['image'];?>"
				alt="" />
			<p><?php echo $item['description'];?></p>
			</li>
		
			<?php
		}
		?>
		</ul>
	</div>		
<?php
	}
?>
<!-- end product--></div>
<div class="clear"></div>
<?php $this->LoadBlock('BottomMenu');?></div>
<!-- end main-->